package com.jmy.exception;

import com.jmy.pageresult.PageResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: VE
 * @DATE: 2022/9/24 14:26
 * 描述:
 */
@ControllerAdvice
public class GlobalException {

    private Logger logger = LoggerFactory.getLogger(GlobalException.class);

    @ExceptionHandler
    @ResponseBody
    public PageResult exceptionHandler(Exception ex){
        logger.error("出现异常:"+ex);
        return PageResult.error();
    }
}
